<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
    <title>有云的天空</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

    <link rel="stylesheet" type="text/css" href="bootstrap/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="bootstrap/stylesheets/theme.css">
    <style type="text/css">
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

    <script src="js/jquery.min.js" type="text/javascript"></script>
    <%--<script src="bootstrap/lib/bootstrap/js/bootstrap.js"></script>--%>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
</head>


<body>

<%--导航栏--%>
<div class="navbar">
    <div class="navbar-inner">
        <ul class="nav pull-right">
        </ul>
        <a class="brand" href="index.jsp"><span class="first">Your</span> <span class="second">Company</span></a>
    </div>
</div>

<%--密码框--%>
<div class="row-fluid">
    <div class="dialog">
        <div class="block">
            <p class="block-heading">Sign In</p>
            <div class="block-body">
                <form method="post" action="logon/login.do">
                    <%--登陆失败提示--%>

                    <label>用户名</label><input id="userid" name="userid" type="text" class="span12">
                    <label>密码</label><input id="password" name="password" type="password" class="span12">
                    <div style="height: 5px"></div> <!-- 撑高度 -->

                    <%--spring mvc登陆.do
                        成功跳转到主页面;失败跳转回这里
                    --%>
                    <button type="submit" class="btn btn-primary pull-right" onclick="return check();">登 陆</button>

                    <label class="remember-me"><input id="remember" type="checkbox"> 记住我</label>
                    <div class="clearfix"></div>
                </form>
            </div>
        </div>

        <%--<p class="pull-right" style=""><a href="http://www.portnine.com" target="blank">Theme by Portnine</a></p>--%>

        <%--TODO 重置密码/注册--%>
        <p><a href="reset-password.html">Forgot your password?</a></p>
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function(){
        var userid = $.cookie('userid');
        if (userid !== undefined && userid !== null && userid !== '' && userid !== 'null') {
            $("#userid").val(userid);
            $("#remember").attr("checked","checked");
        }
    });

    function check() {
        var userid = $("#userid").val();
        if (userid == null || userid == '') {
            alert('用户名必须输入');
            return false;
        }

        var password =$("#password").val();
        if (password == null || password == '') {
            alert('密码必须输入');
            return false;
        }

        var remember = $("#remember").is(":checked");
        if (remember) {
            $.cookie("userid", userid, { expires: 7 });
        } else {
            $.cookie("userid", null);
        }
        return true;
    }
</script>

</body>
</html>

